/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelConsultaAvanzada.java
 *
 * Created on 29/05/2011, 03:48:10 PM
 */
package gui;
import accesoDatos.DAODesdeGUI;
import controlador.*;
import controlador.ControladorMaterial;
import java.util.*;
import logica.*;
import javax.swing.*;
/**
 *
 * @author Gamboa Family
 */
public class PanelConsultaAvanzada extends javax.swing.JPanel {
    PanelResultadosConsulta panelResultados;
    DAODesdeGUI acceso=new DAODesdeGUI();
    Boolean puedeDescargar =false;
    String codigoUsuarioConsulta;

    /** Creates new form PanelConsultaAvanzada */
    public PanelConsultaAvanzada() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanelBotonesAtrasAdelante = new javax.swing.JPanel();
        jBAtras = new javax.swing.JButton();
        jBAdelante = new javax.swing.JButton();
        jPanelCentral = new javax.swing.JPanel();
        jPanelInicial = new javax.swing.JPanel();
        jTFEntrada = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jcbusqueda1 = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jtfautor1 = new javax.swing.JTextField();
        jcbusqueda2 = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jtfpalabraclave1 = new javax.swing.JTextField();
        jcbusqueda3 = new javax.swing.JComboBox();
        jcfechapublicacion1 = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jcidioma1 = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jcformato1 = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jBBuscar = new javax.swing.JButton();
        jcfarea = new javax.swing.JComboBox();

        setBackground(new java.awt.Color(255, 255, 255));

        jPanelBotonesAtrasAdelante.setBackground(new java.awt.Color(255, 255, 255));

        jBAtras.setBackground(new java.awt.Color(255, 255, 255));
        jBAtras.setFont(new java.awt.Font("Verdana", 1, 18));
        jBAtras.setForeground(new java.awt.Color(235, 30, 30));
        jBAtras.setText("<");
        jBAtras.setEnabled(false);
        jBAtras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBAtrasActionPerformed(evt);
            }
        });

        jBAdelante.setBackground(new java.awt.Color(255, 255, 255));
        jBAdelante.setFont(new java.awt.Font("Verdana", 1, 18));
        jBAdelante.setForeground(new java.awt.Color(235, 30, 30));
        jBAdelante.setText(">");
        jBAdelante.setEnabled(false);
        jBAdelante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBAdelanteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelBotonesAtrasAdelanteLayout = new javax.swing.GroupLayout(jPanelBotonesAtrasAdelante);
        jPanelBotonesAtrasAdelante.setLayout(jPanelBotonesAtrasAdelanteLayout);
        jPanelBotonesAtrasAdelanteLayout.setHorizontalGroup(
            jPanelBotonesAtrasAdelanteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBotonesAtrasAdelanteLayout.createSequentialGroup()
                .addComponent(jBAtras)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jBAdelante)
                .addContainerGap(919, Short.MAX_VALUE))
        );
        jPanelBotonesAtrasAdelanteLayout.setVerticalGroup(
            jPanelBotonesAtrasAdelanteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBotonesAtrasAdelanteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jBAtras, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jBAdelante, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanelCentral.setBackground(new java.awt.Color(255, 255, 255));

        jPanelInicial.setBackground(new java.awt.Color(255, 255, 255));

        jTFEntrada.setFont(new java.awt.Font("Verdana", 0, 18));
        jTFEntrada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTFEntradaActionPerformed(evt);
            }
        });

        jLabel5.setBackground(new java.awt.Color(255, 255, 255));
        jLabel5.setFont(new java.awt.Font("Verdana", 1, 18));
        jLabel5.setForeground(new java.awt.Color(130, 134, 135));
        jLabel5.setText("Título");

        jcbusqueda1.setFont(new java.awt.Font("Verdana", 0, 18)); // NOI18N
        jcbusqueda1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Con todas las palabras", "Con algunas de estas palabras", "Sin estas palabras" }));
        jcbusqueda1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jcbusqueda1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbusqueda1ActionPerformed(evt);
            }
        });

        jLabel6.setBackground(new java.awt.Color(255, 255, 255));
        jLabel6.setFont(new java.awt.Font("Verdana", 1, 18));
        jLabel6.setForeground(new java.awt.Color(130, 134, 135));
        jLabel6.setText("Autor");

        jtfautor1.setFont(new java.awt.Font("Verdana", 0, 18));
        jtfautor1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtfautor1ActionPerformed(evt);
            }
        });

        jcbusqueda2.setFont(new java.awt.Font("Verdana", 0, 18)); // NOI18N
        jcbusqueda2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Con todas las palabras", "Con algunas de estas palabras", "Sin estas palabras" }));
        jcbusqueda2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jcbusqueda2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbusqueda2ActionPerformed(evt);
            }
        });

        jLabel7.setBackground(new java.awt.Color(255, 255, 255));
        jLabel7.setFont(new java.awt.Font("Verdana", 1, 18));
        jLabel7.setForeground(new java.awt.Color(130, 134, 135));
        jLabel7.setText("Palabra Clave");

        jtfpalabraclave1.setFont(new java.awt.Font("Verdana", 0, 18));
        jtfpalabraclave1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtfpalabraclave1ActionPerformed(evt);
            }
        });

        jcbusqueda3.setFont(new java.awt.Font("Verdana", 0, 18));
        jcbusqueda3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Con todas las palabras", "Con algunas de estas palabras", "Sin estas palabras" }));
        jcbusqueda3.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jcbusqueda3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbusqueda3ActionPerformed(evt);
            }
        });

        jcfechapublicacion1.setFont(new java.awt.Font("Verdana", 0, 18));
        jcfechapublicacion1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Cualquiera", "En el ultimo mes", "Hace 6 meses", "Hace un año", "Hace dos años", "Hace 5 años" }));
        jcfechapublicacion1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jcfechapublicacion1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcfechapublicacion1ActionPerformed(evt);
            }
        });

        jLabel8.setBackground(new java.awt.Color(255, 255, 255));
        jLabel8.setFont(new java.awt.Font("Verdana", 1, 18));
        jLabel8.setForeground(new java.awt.Color(130, 134, 135));
        jLabel8.setText("Fecha Publicación");

        jcidioma1.setFont(new java.awt.Font("Verdana", 0, 18));
        jcidioma1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todos los Idiomas", "Español", "Ingles", "Frances", "Aleman ", "Otro" }));
        jcidioma1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jcidioma1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcidioma1ActionPerformed(evt);
            }
        });

        jLabel9.setBackground(new java.awt.Color(255, 255, 255));
        jLabel9.setFont(new java.awt.Font("Verdana", 1, 18)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(130, 134, 135));
        jLabel9.setText("Idioma");

        jLabel11.setBackground(new java.awt.Color(255, 255, 255));
        jLabel11.setFont(new java.awt.Font("Verdana", 1, 18));
        jLabel11.setForeground(new java.awt.Color(130, 134, 135));
        jLabel11.setText("Formato archivo");

        jcformato1.setFont(new java.awt.Font("Verdana", 0, 18));
        jcformato1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todos", "pdf", "doc", "odt", "jpeg", "jpg" }));
        jcformato1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jcformato1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcformato1ActionPerformed(evt);
            }
        });

        jLabel10.setBackground(new java.awt.Color(255, 255, 255));
        jLabel10.setFont(new java.awt.Font("Verdana", 1, 18));
        jLabel10.setForeground(new java.awt.Color(130, 134, 135));
        jLabel10.setText("Area");

        jLabel3.setBackground(new java.awt.Color(255, 255, 255));
        jLabel3.setFont(new java.awt.Font("Verdana", 1, 48));
        jLabel3.setForeground(new java.awt.Color(235, 30, 30));
        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/consultaAvanzada.jpg"))); // NOI18N
        jLabel3.setText("Consulta Avanzada");

        jBBuscar.setBackground(new java.awt.Color(255, 255, 255));
        jBBuscar.setFont(new java.awt.Font("Verdana", 1, 18));
        jBBuscar.setForeground(new java.awt.Color(235, 30, 30));
        jBBuscar.setText("Buscar");
        jBBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBBuscarActionPerformed(evt);
            }
        });

        jcfarea.setFont(new java.awt.Font("Verdana", 0, 18));
        String[] string=acceso.accederaAreasDeinteres();
        jcfarea.addItem("Todas las Areas");

        for(int i=0;i<string.length;i++)
        {
            jcfarea.addItem(string[i]);

        }
        jcfarea.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jcfarea.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcfareaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelInicialLayout = new javax.swing.GroupLayout(jPanelInicial);
        jPanelInicial.setLayout(jPanelInicialLayout);
        jPanelInicialLayout.setHorizontalGroup(
            jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInicialLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelInicialLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3)
                        .addGap(47, 47, 47))
                    .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelInicialLayout.createSequentialGroup()
                            .addGap(25, 25, 25)
                            .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel6)
                                .addComponent(jLabel7)
                                .addComponent(jLabel5))
                            .addGap(18, 18, 18)
                            .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jTFEntrada)
                                .addComponent(jtfautor1)
                                .addComponent(jtfpalabraclave1, javax.swing.GroupLayout.PREFERRED_SIZE, 513, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jcbusqueda3, 0, 0, Short.MAX_VALUE)
                                .addComponent(jcbusqueda2, 0, 0, Short.MAX_VALUE)
                                .addComponent(jcbusqueda1, 0, 255, Short.MAX_VALUE)))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelInicialLayout.createSequentialGroup()
                            .addGap(90, 90, 90)
                            .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel10)
                                .addComponent(jLabel9))
                            .addGap(18, 18, 18)
                            .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanelInicialLayout.createSequentialGroup()
                                    .addComponent(jcidioma1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(jLabel8)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcfechapublicacion1, 0, 357, Short.MAX_VALUE))
                                .addComponent(jcfarea, 0, 775, Short.MAX_VALUE))))
                    .addGroup(jPanelInicialLayout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addGap(17, 17, 17)
                        .addComponent(jcformato1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 673, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(26, 26, 26))
            .addGroup(jPanelInicialLayout.createSequentialGroup()
                .addGap(440, 440, 440)
                .addComponent(jBBuscar)
                .addContainerGap(471, Short.MAX_VALUE))
        );
        jPanelInicialLayout.setVerticalGroup(
            jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInicialLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbusqueda1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jTFEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtfautor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcbusqueda2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbusqueda3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtfpalabraclave1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jcidioma1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jcfechapublicacion1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jcfarea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(jcformato1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addComponent(jBBuscar)
                .addContainerGap(24, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanelCentralLayout = new javax.swing.GroupLayout(jPanelCentral);
        jPanelCentral.setLayout(jPanelCentralLayout);
        jPanelCentralLayout.setHorizontalGroup(
            jPanelCentralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelInicial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanelCentralLayout.setVerticalGroup(
            jPanelCentralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelInicial, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanelCentral, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanelBotonesAtrasAdelante, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanelBotonesAtrasAdelante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanelCentral, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jBBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBBuscarActionPerformed
        // TODO add your handling code here:
        realizarBusqueda();
    }//GEN-LAST:event_jBBuscarActionPerformed

    private void jBAtrasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAtrasActionPerformed
        // TODO add your handling code here:        
        jPanelCentral.removeAll();
        jPanelCentral.add(jPanelInicial);
        jBAdelante.setEnabled(true);
        jBAtras.setEnabled(false);
        validate();
        repaint();
    }//GEN-LAST:event_jBAtrasActionPerformed

    private void jBAdelanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAdelanteActionPerformed
        // TODO add your handling code here:
        jPanelCentral.removeAll();
        jPanelCentral.add(panelResultados);
        jBAtras.setEnabled(true);
        jBAdelante.setEnabled(false);
        validate();
        repaint();
    }//GEN-LAST:event_jBAdelanteActionPerformed

    private void jTFEntradaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTFEntradaActionPerformed
        // TODO add your handling code here:
        realizarBusqueda();
    }//GEN-LAST:event_jTFEntradaActionPerformed

    private void jcbusqueda1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbusqueda1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jcbusqueda1ActionPerformed

    private void jtfautor1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfautor1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtfautor1ActionPerformed

    private void jcbusqueda2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbusqueda2ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jcbusqueda2ActionPerformed

    private void jtfpalabraclave1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfpalabraclave1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtfpalabraclave1ActionPerformed

    private void jcbusqueda3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbusqueda3ActionPerformed

}//GEN-LAST:event_jcbusqueda3ActionPerformed

    private void jcfechapublicacion1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcfechapublicacion1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jcfechapublicacion1ActionPerformed

    private void jcidioma1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcidioma1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jcidioma1ActionPerformed

    private void jcformato1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcformato1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jcformato1ActionPerformed

    private void jcfareaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcfareaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcfareaActionPerformed

    public void realizarBusqueda(){
        ControladorMaterial controlMat = new ControladorMaterial();
        panelResultados = new PanelResultadosConsulta();
        if(puedeDescargar)panelResultados.habilitarDescarga();
        panelResultados.setUsuarioQueConsulta(codigoUsuarioConsulta);
        //el metodo consultaGeneral() retorna un Vector de Material para que la interfaz funcione y muestre 
        //los resultados de la busqeda.
        Vector<Material> resultadosBusqueda = controlMat.consultaGeneral(jTFEntrada.getText());
        if(resultadosBusqueda != null && !resultadosBusqueda.isEmpty()){
            jPanelCentral.removeAll();
            panelResultados.mostrarResulatdos(resultadosBusqueda, jTFEntrada);            
            jPanelCentral.add(panelResultados);
            jBAtras.setEnabled(true);
            validate();
            repaint();   
        }
        else{
            JOptionPane.showMessageDialog(this, "No se encontró ningún resultado "
                    + "para su consulta.\nPor favor intente con otras palabras.", 
                        "Sin resultados", JOptionPane.ERROR_MESSAGE);
            jTFEntrada.setText("");
        }
    }

    public void habilitarDescarga(){
        puedeDescargar = true;
    }

    public void setUsuarioQueConsulta(String codigoUsr){
        codigoUsuarioConsulta = codigoUsr;
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBAdelante;
    private javax.swing.JButton jBAtras;
    private javax.swing.JButton jBBuscar;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanelBotonesAtrasAdelante;
    private javax.swing.JPanel jPanelCentral;
    private javax.swing.JPanel jPanelInicial;
    private javax.swing.JTextField jTFEntrada;
    private javax.swing.JComboBox jcbusqueda1;
    private javax.swing.JComboBox jcbusqueda2;
    private javax.swing.JComboBox jcbusqueda3;
    private javax.swing.JComboBox jcfarea;
    private javax.swing.JComboBox jcfechapublicacion1;
    private javax.swing.JComboBox jcformato1;
    private javax.swing.JComboBox jcidioma1;
    private javax.swing.JTextField jtfautor1;
    private javax.swing.JTextField jtfpalabraclave1;
    // End of variables declaration//GEN-END:variables
}
